home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / portable / winsertl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-18  |  1.7 KB  |  77 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3. #undef    winsert
  4.  
  5. #ifdef PDCDEBUG
  6. char *rcsid_winsertl = "$Header: C:\CURSES\portable\RCS\winsertl.c 2.1 1993/06/18 20:21:43 MH Rel MH $";
  7. #endif
  8.  
  9.  
  10.  
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   winsert()    - Insert line
  15.  
  16.   X/Open Description:
  17.      A blank line is inserted above the current line and the bottom
  18.      line is lost.
  19.  
  20.      NOTE: insertln() is a macro.
  21.  
  22.   PDCurses Description:
  23.      The mv[w]insertln() routines have been added to the X/Open
  24.      interface specification as a convienience.
  25.  
  26.   X/Open Return Value:
  27.      These functions return OK on success and ERR on error.
  28.  
  29.   PDCurses Errors:
  30.      It is an error to call this function with a NULL window pointer.
  31.  
  32.   Portability:
  33.      PDCurses    int winsertln( WINDOW* win );
  34.      X/Open Dec '88    int winsertln( WINDOW* win );
  35.      BSD Curses    int winsertln( WINDOW* win );
  36.      SYS V Curses    int winsertln( WINDOW* win );
  37.  
  38.  
  39. **man-end**********************************************************************/
  40.  
  41. int    winsertln(WINDOW *win)
  42. {
  43.     chtype    blank;
  44.     chtype*    temp;
  45.     chtype*    end;
  46.     short    y;
  47.  
  48. #ifdef PDCDEBUG
  49.     if (trace_on) PDC_debug("winsertln() - called\n");
  50. #endif
  51.  
  52.     if (win == (WINDOW *)NULL)
  53.         return( ERR );
  54.  
  55.     blank    = win->_blank | win->_attrs;
  56.     temp    = win->_y[win->_bmarg];
  57.  
  58.     for (y = win->_bmarg; y > win->_cury; y--)
  59.     {
  60.         win->_y[y]     = win->_y[y - 1];
  61.         win->_firstch[y] = 0;
  62.         win->_lastch[y] = win->_maxx - 1;
  63.     }
  64.  
  65.     win->_y[win->_cury] = temp;
  66.  
  67.     for (end = &temp[win->_maxx - 1]; temp <= end; temp++)
  68.     {
  69.         *temp = blank;
  70.     }
  71.  
  72.     win->_firstch[win->_cury] = 0;
  73.     win->_lastch[win->_cury] = win->_maxx - 1;
  74.  
  75.     return( OK );
  76. }
  77.